import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:redbook_app/pages/TabContent.dart';

class Download extends StatefulWidget {
  const Download({super.key});

  @override
  State<Download> createState() => _DownloadState();
}

class _DownloadState extends State<Download>  with SingleTickerProviderStateMixin{
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 3, vsync: this);
    _tabController.addListener((){
      // print(_tabController.index);
      // print(_tabController.animation!.value);
    });

  }
  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    _tabController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("下载数据"),
      ),
      bottomNavigationBar:TabBar(
          controller: _tabController,
          tabs: [
        Tab(text: "已下载",),
        Tab(text: "下载中",),
        Tab(text: "下载失败",)
      ]),
      body: TabBarView(
        controller: _tabController,
        children: [
          Tabcontent(status: 2),
          Text("下载中"),
          Text("下载失败")
        ],
      ),
    );
  }
}
